package s2leinshu.Services;

import s2elinshu.Interfaces.SungJuk2IService;
import s2elinshu.model.SungJuk2VO;
import s2elinshu.model.SungJukVO;

public class SungJuk2Service implements SungJuk2IService {

	@Override
	public void getTotal(SungJuk2VO sj) {
		int tot = sj.getKor()+sj.getEng()+sj.getMat();
		sj.setTot(tot);
	}

	@Override
	public void getAverage(SungJuk2VO sj) {
		double  avg = (double)sj.getTot()/3;
		sj.setAvg(avg);
	}

	@Override
	public void getGrade(SungJuk2VO sj) {
		char grd;
		switch ((int) sj.getAvg()/ 10) {
		case 10:
		case 9:
			grd = SU;
			break;
		case 8:
			grd = WU;
			break;
		case 7:
			grd = MI;
			break;
		case 6:
			grd = YA;
			break;
		default:
			grd = GA;
		}
	sj.setGrd(grd);
	}


}  // public class SungJuk2Service implements SungJuk2IService 
